<%@ page contentType="text/html;charset=utf-8"%>
<%@ page
	import="java.io.*, java.sql.*, java.util.*, java.text.*, napal.*, util.*"%>
<%@ page import="org.apache.ibatis.*"%>
<%
	request.setCharacterEncoding("utf-8");
%>
<%
	String cmd = request.getParameter("cmd");
String selectedCategory = request.getParameter("category");
String userDepartNumber = (String)session.getAttribute("userDepart");

String m = (String)session.getAttribute("managerID");
String u = (String)session.getAttribute("userID");
String uRank = (String)session.getAttribute("userRank");


if(u!=null) {
	if (request.getParameter("rentalday") != null
			&& request.getParameter("rentalvalue") != null) {

		
		String rentalDay = request.getParameter("rentalday");
		int day = Integer.parseInt(rentalDay);//대여기간
		String rentalValue = request.getParameter("rentalvalue");//대여분류
		String rentalmemo = request.getParameter("rentalmemo");//대여사유
		
		
						if ("수정".equals(cmd)) {

	RentalHome.updateRentalWait(day, rentalValue, rentalmemo, u);

%>
<script language=javascript>
	self.window.alert("신청서를 수정하였습니다.");
	location.href = "./Main.jsp";
</script>

<%
	
			}
		}
	}

%>

 <%@ include file="./Header.jsp"%>
</td>
</TR>
<TR HEIGHT="100">
	<td>
	<a href="RentalList_s.jsp" class="btn btn-link btn-small">대여신청<br></a>
> 기자재상세정보
> 대여신청
<br><br><br>
		
		<form onsubmit="return confirm('해당 기자재를 대여신청하시겠습니까?'); ">
		
			<p align="center">
			<table width=400, height=100, class="table">
			<% for(RentalWait w : RentalHome.rentalWait(u)){ %>
				<tr>
					<td width=20%><p align="right">
							<b>대여자ID</b>
						</p></td>
					<td width=80%><p align="center">
							<%
								if (u != null) {
							%>
							<%=(String) session.getAttribute("userID")%>
							<%
								}
							%>

						</p></td>
				</tr>

				<tr>
					<td width=20%><p align="right">
							<b>대여자이름</b>
						</p></td>
					<td width=80%><p align="center">
							<%
								if (u != null) {
							%>
							<%=(String) session.getAttribute("userName")%>
							<%
								}
							%>

						</p></td>
				</tr>

				<tr>
					<td width=20%><p align="right">
							<b>대여자소속학과</b>
						</p></td>
					<td width=80%><p align="center">
							<%
								if (u != null) {
							%>
							<%=(String) session.getAttribute("userDepart")%>
							<%
								}
							%>

						</p></td>
				</tr>
				<tr>
					<td width=20%><p align="right">
							<b>대여모델명</b>
						</p></td>
					<td width=80%><p align="center">
							<%=w.get모델명()%>
						</p></td>
				</tr>

				<tr>
				
					<Td><p align="right">
							<b>대여기간</b>
						</p></Td>
					<td><p align=center>
							<input type="text" name="rentalday" value="<%= w.get대여기간()%>">일
						</p></td>
						<p align=center style="color : gray;">기본 : 실습용(7일/30일)&nbsp;&nbsp;인도창(365일)&nbsp;&nbsp;프로젝트(100일)&nbsp;&nbsp;연구용(100일(한학기))</p></td>
				</tr>
				<tr>
					<td><p align="right">
							<b>대여분류</b>
						</p></td>
					<td><p align=center>
							<%if(uRank.equals("재학생")){ %>
							
							<input type="radio" name="rentalvalue" value="실습용" checked>실습용
							&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="rentalvalue"
								value="연구용" disabled="disabled">연구용
					<%} else if(uRank.equals("교수")||uRank.equals("학과장")||uRank.equals("외래교수")){	%>
						
							<input type="radio" name="rentalvalue" value="실습용" disabled="disabled">실습용
							&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="rentalvalue"
								value="연구용" checked>연구용
						<%}
						
							
					
					%>
						</p></td>
				</tr>
				<tr>
					<td><p align="right">
							<b>대여사유</b>
						</p></td>
					<td><p align=center>
							  <textarea name="rentalmemo" style="width: 70%" rows=6 class="input-block-level"><%=w.get대여사유() %></textarea>
						</p></td>
				</tr>
				<%} %>
			</table>
			</p>
			<p align="center">
				<a href="Main.jsp" name="cmd" class="btn btn-inverse">이전으로</a>
				<input name="cmd" class="btn btn-inverse" type=submit value="수정">
			</p>

		</form>

	</td>
</tr>
<TR HEIGHT="50">
	<TD><%@ include file="./bottom.jsp"%></TD>
</TR>
</TABLE>
</body>
</html>